package com.yingli.network;

import android.os.Bundle;
import android.os.Handler;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.yingli.network.task.NetworkTask;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;

//import org.apache.http.client.HttpClient;

public class AsyncTaskActivity extends AppCompatActivity {

    private TextView tvWeb;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_httpclient);
        NetworkTask task = new NetworkTask();
        String [] params = new String[]{"param1","param2","params3"};
        task.execute(params);
        new Handler().postDelayed(()->{
            try {
                Thread.sleep(6000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            task.cancel(false);
        },1000);

    }

}
